class RegisterController < ApplicationController
  def add_book
  end

  def add_book_info
    p "-------------------------"
    p book_info_data
    book_info = TbBookinfo.new(book_info_data)

    book_info.save
    render :json => {:status => true}
  end

  def add_user_info
    p "-------------------------"
    p reader_info
    user_info = TbReader.new(reader_info)
    user_info.save
    render :json => {:status => true}
  end

  def add_publish_info
    p "-------------------------"
    p publisn_info
    publish = TbPublish.new(publisn_info)
    publish.save
    render :json => {:status => true}
  end

  def add_book_type_info
    p "-------------------------"
    p book_type_info
    book_type = TbBooktype.new(book_type_info)
    book_type.save
    render :json => {:status => true}
  end

  def book_type_info
    {
        :booktypeid => params["booktypeid"],
        :Typename => params["Typename"],
        :Type_outline => params["Type_outline"],
    }
  end

  def publisn_info

    {
        :ISBN => params["ISBN"],
        :pubname => params["pubname"],
        :pubaddr => params["pubaddr"],
        :Zip_code => params["Zip_code"],
        :first_pubtel => params["first_pubtel"],
        :second_pubtel => params["second_pubtel"],
        :pubperson => params["pubperson"],
    }
  end


  def book_info_data
    {
        :bookid => params["bookid"],
        :barcode => params["barcode"],
        :bookname => params["bookname"],
        :typeid => params["typeid"],
        :author => params["author"],
        :authorcomtroy => params["authorcomtroy"],
        :translator => params["translator"],
        :ISBN => params["ISBN"],
        :price => params["price"],
        :bookcase => params["bookcase"],
        :bookpage => nil
    }
  end

  def reader_info
    {
        :readerid => params["readerid"],
        :name => params["name"],
        :sex => params["sex"],
        :barcode => params["barcode"],
        :peperNO => params["peperNO"],
        :Type => params["Type"],
        :Tel => params["Tel"],
        :Email => params["Email"],
        :Documents_state => params["Documents_state"],
        :remark => params["remark"],
    }
  end
end
